<?php defined('InShopNC') or exit('Access Invalid!');?>
<!--砍价和拼团模块-->
<script type="text/javascript">
    var SHOP_SITE_URL = "<?php echo SHOP_SITE_URL; ?>";
    var UPLOAD_SITE_URL = "<?php echo UPLOAD_SITE_URL; ?>";
    var important_goods_max = 4;
</script>
<style>
    .home-templates-board-layout .middle {
        width: 254px !important;
    }
    .home-templates-board-layout .left {
        width: 160px;
    }
    .home-templates-board-layout dd.act-pic .picture {
        width: 110px;
        height: 240px;
    }
    .home-templates-board-layout {
        background: none;
    }
    .home-templates-board-layout dl dt a {
        color: #555 !important;
        border: solid 1px #E7E7E7 !important;;
        background: #F7F7F7 !important;;
    }
    .home-templates-board-layout .goods-list {
        width: 245px !important;
    }
</style>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <a class="back" href="index.php?act=web_config&op=new_web_config" title="返回<?php echo '板块区'; ?>列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3><?php echo $lang['web_config_index']; ?> - <?php echo $lang['web_config_web_edit']; ?>
                    “<?php echo $output['code_recommend_list']['code_info'][0]['recommend']['name'];?>-<?php echo $output['code_recommend_list']['code_info'][1]['recommend']['name'];?>”板块</h3>
                <h5><?php echo $lang['nc_web_index_subhead']; ?></h5>
            </div>
        </div>
    </div>
    <!-- 操作说明 -->
    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom"><i class="fa fa-lightbulb-o"></i>
            <h4 title="<?php echo $lang['nc_prompts_title'];?>"><?php echo $lang['nc_prompts'];?></h4>
            <span id="explanationZoom" title="<?php echo $lang['nc_prompts_span'];?>"></span> </div>
        <ul>
            <li><?php echo $lang['web_config_edit_help1'];?></li>
            <li>如果不选择商品，即默认左边显示拼团，右边显示砍价</li>
        </ul>
    </div>
    <div class="ncap-form-all">
        <div class="title">
            <h3>“<?php echo $output['code_recommend_list']['code_info'][0]['recommend']['name'];?>-<?php echo $output['code_recommend_list']['code_info'][1]['recommend']['name'];?>”区域设置</h3>
        </div>
        <dl class="row">
            <dt class="tit">
                <label><?php echo $lang['web_config_edit_html'].$lang['nc_colon'];?></label>
            </dt>
            <dd class="opt">
                <div class="home-templates-board-layout style-<?php echo $output['web_array']['style_name'];?>">
                    <div class="left">
                        <dl>
                            <dt>
                                <a href="JavaScript:show_dialog('upload_act_left');"><i class="fa fa-picture-o"></i><?php echo $lang['nc_edit'];?></a></dt>
                            <dd class="act-pic">
                                <div id="picture_act_left" class="picture">
                                    <?php if(!empty($output['code_act_left']['code_info']['pic'])) { ?>
                                        <img src="<?php echo UPLOAD_SITE_URL.'/'.$output['code_act_left']['code_info']['pic'];?>"/>
                                    <?php } ?>
                                </div>
                            </dd>
                        </dl>
                    </div>
                    <div class="middle">
                        <div>
<!--                            --><?php //if (is_array($output['code_recommend_list']['code_info']) && !empty($output['code_recommend_list']['code_info'])) { ?>
<!--                                --><?php //foreach ($output['code_recommend_list']['code_info'] as $key => $val) { ?>
                                    <dl recommend_id="<?php echo 0;?>">
                                        <dt>
                                            <h4><?php echo $output['code_recommend_list']['code_info'][0]['recommend']['name'];?></h4>
                                            <a href="JavaScript:show_recommend_dialog(<?php echo 0;?>);">
                                                <i class="fa fa-picture-o"></i><?php echo $lang['nc_edit'];?></a>
                                            </a>
                                        </dt>
                                        <dd>
                                            <?php if(!empty($output['code_recommend_list']['code_info'][0]['goods_list']) && is_array($output['code_recommend_list']['code_info'][0]['goods_list'])) { ?>
                                                <ul style="width:345px !important;" class="goods-list">
                                                    <?php foreach($output['code_recommend_list']['code_info'][0]['goods_list'] as $k => $v) { ?>
                                                        <li>
                                                            <span>
                                                                <a href="javascript:void(0);"> <img title="<?php echo $v['goods_name'];?>" src="<?php echo strpos($v['goods_pic'],'http')===0 ? $v['goods_pic']:UPLOAD_SITE_URL."/".$v['goods_pic'];?>"/></a>
                                                            </span>
                                                        </li>
                                                    <?php } ?>
                                                </ul>
                                            <?php } ?>
                                        </dd>
                                    </dl>
<!--                                --><?php //} ?>
<!--                            --><?php //} ?>
                        </div>
                    </div>
                    <div class="left">
                        <dl>
                            <dt>
                                <a href="JavaScript:show_dialog('upload_act_right');"><i class="fa fa-picture-o"></i><?php echo $lang['nc_edit'];?></a></dt>
                            <dd class="act-pic">
                                <div id="picture_act_right" class="picture">
                                    <?php if(!empty($output['code_act_right']['code_info']['pic'])) { ?>
                                        <img src="<?php echo UPLOAD_SITE_URL.'/'.$output['code_act_right']['code_info']['pic'];?>"/>
                                    <?php } ?>
                                </div>
                            </dd>
                        </dl>
                    </div>
                    <div class="middle">
                        <div>
                            <dl recommend_id="<?php echo 1;?>">
                                <dt>
                                    <h4><?php echo $output['code_recommend_list']['code_info'][1]['recommend']['name'];?></h4>
                                    <a href="JavaScript:show_recommend_dialog(<?php echo 1;?>);">
                                        <i class="fa fa-picture-o"></i><?php echo $lang['nc_edit'];?></a>
                                    </a>
                                </dt>
                                <dd>
                                    <?php if(!empty($output['code_recommend_list']['code_info'][1]['goods_list']) && is_array($output['code_recommend_list']['code_info'][1]['goods_list'])) { ?>
                                        <ul style="width:345px !important;" class="goods-list">
                                            <?php foreach($output['code_recommend_list']['code_info'][1]['goods_list'] as $k => $v) { ?>
                                                <li>
                                                    <span>
                                                        <a href="javascript:void(0);"> <img title="<?php echo $v['goods_name'];?>" src="<?php echo strpos($v['goods_pic'],'http')===0 ? $v['goods_pic']:UPLOAD_SITE_URL."/".$v['goods_pic'];?>"/></a>
                                                    </span>
                                                </li>
                                            <?php } ?>
                                        </ul>
                                    <?php } ?>
                                </dd>
                            </dl>
                        </div>
                    </div>
                </div>
            </dd>
        </dl>
    </div>
    <div class="bot"><a href="index.php?act=web_config&op=html_update&web_id=<?php echo $_GET['web_id'];?>" class="ncap-btn-big ncap-btn-green" id="submitBtn"><?php echo $lang['web_config_web_html'];?></a> </div>

</div>

<!-- 活动图片 -->
<div id="upload_act_left_dialog" class="upload_act_dialog" style="display:none;">
    <div class="s-tips"><i class="fa fa-lightbulb-o"></i><?php echo $lang['web_config_prompt_act'];?></div>
    <form id="upload_act_left_form" name="upload_act_form" enctype="multipart/form-data" method="post" action="index.php?act=web_config&op=upload_pic" target="upload_pic">
        <input type="hidden" name="form_submit" value="ok" />
        <input type="hidden" name="web_id" value="<?php echo $output['code_act_left']['web_id'];?>">
        <input type="hidden" name="code_id" value="<?php echo $output['code_act_left']['code_id'];?>">
        <input type="hidden" name="act[pic]" value="<?php echo $output['code_act_left']['code_info']['pic'];?>">
        <input type="hidden" name="act[type]" value="pic">
        <div class="ncap-form-default" id="upload_act_left_type_pic" <?php if($output['code_act_left']['code_info']['type'] == 'adv') { ?>style="display:none;"<?php } ?>>
            <!--<dl class="row">
                <dt class="tit"><?php /*echo '活动名称';*/?></dt>
                <dd class="opt">
                    <input class="input-txt" type="text" name="act[title]" value="<?php /*echo $output['code_act']['code_info']['title'];*/?>">
                    <p class="notic"><?php /*echo '';*/?></p>
                </dd>
            </dl>-->
            <dl class="row">
                <dt class="tit">
                    <label><?php echo $lang['web_config_upload_url'].$lang['nc_colon'];?></label>
                </dt>
                <dd class="opt">
                    <input name="act[url]" value="<?php echo !empty($output['code_act_left']['code_info']['url']) ? $output['code_act_left']['code_info']['url']:SHOP_SITE_URL;?>" class="input-txt" type="text">
                    <p class="notic"><?php echo $lang['web_config_upload_act_url'];?></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label><?php echo $lang['web_config_upload_act'];?></label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show"><span class="type-file-box">
            <input type='text' name='textfield' id='textfield2' class='type-file-text' />
            <input type='button' name='button' id='button2' value='选择上传...' class='type-file-button' />
            <input name="pic" id="pic2" type="file" class="type-file-file" size="30">
            </span></div>
                    <p class="notic"><?php echo $lang['web_config_upload_act_tips'];?></p>
                </dd>
            </dl>
            <div class="bot"><a href="JavaScript:void(0);" onclick="$('#upload_act_left_form').submit();" class="ncap-btn-big ncap-btn-green"><?php echo $lang['nc_submit'];?></a></div>
        </div>
    </form>
</div>
<!-- 商品推荐 -->
<div id="recommend_list_dialog" style="display:none;">
    <div class="s-tips"><i></i>小提示：单击查询出的商品选中，双击已选择的可以删除，最多4个，保存后生效。</div>
    <form id="recommend_list_form">
        <input type="hidden" name="web_id" value="<?php echo $output['code_recommend_list']['web_id'];?>">
        <input type="hidden" name="code_id" value="<?php echo $output['code_recommend_list']['code_id'];?>">
        <div id="recommend_input_list" style="display:none;"><!-- 推荐拖动排序 --></div>
<!--        --><?php //if (is_array($output['code_recommend_list']['code_info']) && !empty($output['code_recommend_list']['code_info'])) { ?>
<!--            --><?php //foreach ($output['code_recommend_list']['code_info'] as $key => $val) { ?>
                <div class="ncap-form-default" select_recommend_id="<?php echo 0;?>">
                    <dl class="row">
                        <dt class="tit"> <?php echo $lang['web_config_recommend_title'];?></dt>
                        <dd class="opt">
                            <input name="recommend_list[<?php echo 0;?>][recommend][name]" value="<?php echo $output['code_recommend_list']['code_info'][0]['recommend']['name'];?>" type="text" class="input-txt">
                            <p class="notic"><?php echo '修改该区域中部推荐商品模块选项卡名称，控制名称字符在3-5字左右，超出范围自动隐藏';?></p>
                        </dd>
                    </dl>
                </div>
                <div class="ncap-form-all" select_recommend_id="<?php echo 0;?>">
                    <dl class="row">
                        <dt class="tit"><?php echo '商品';?></dt>
                        <dd class="opt">
                            <ul class="dialog-goodslist-s1 goods-list">
                                <?php if(!empty($output['code_recommend_list']['code_info'][0]['goods_list']) && is_array($output['code_recommend_list']['code_info'][0]['goods_list'])) { ?>
                                    <?php foreach($output['code_recommend_list']['code_info'][0]['goods_list'] as $k => $v) { ?>
                                        <li id="select_recommend_<?php echo 0;?>_goods_<?php echo $k;?>">
                                            <div ondblclick="del_recommend_goods(<?php echo $v['goods_id'];?>);" class="goods-pic">
                                                <span class="ac-ico" onclick="del_recommend_goods(<?php echo $v['goods_id'];?>);"></span>
                                                <span class="thumb size-72x72"><i></i><img select_goods_id="<?php echo $v['goods_id'];?>" title="<?php echo $v['goods_name'];?>" goods_name="<?php echo $v['goods_name'];?>" src="<?php echo strpos($v['goods_pic'],'http')===0 ? $v['goods_pic']:UPLOAD_SITE_URL."/".$v['goods_pic'];?>" onload="javascript:DrawImage(this,72,72);" /></span>
                                            </div>
                                            <div class="goods-name"><a href="<?php echo SHOP_SITE_URL."/index.php?act=goods&goods_id=".$v['goods_id'];?>" target="_blank"><?php echo $v['goods_name'];?></a></div>
                                            <input name="recommend_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][goods_id]" value="<?php echo $v['goods_id'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][market_price]" value="<?php echo $v['market_price'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][goods_name]" value="<?php echo $v['goods_name'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][goods_price]" value="<?php echo $v['goods_price'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][goods_pic]" value="<?php echo $v['goods_pic'];?>" type="hidden">
                                        </li>
                                    <?php } ?>
                                <?php } ?>
                            </ul>
                        </dd>
                    </dl>
                </div>
<!--            --><?php //} ?>
<!--        --><?php //} ?>
                <div class="ncap-form-default" select_recommend_id="<?php echo 1;?>">
                    <dl class="row">
                        <dt class="tit"> <?php echo $lang['web_config_recommend_title'];?></dt>
                        <dd class="opt">
                            <input name="recommend_list[<?php echo 1;?>][recommend][name]" value="<?php echo $output['code_recommend_list']['code_info'][1]['recommend']['name'];?>" type="text" class="input-txt">
                            <p class="notic"><?php echo '修改该区域中部推荐商品模块选项卡名称，控制名称字符在3-5字左右，超出范围自动隐藏';?></p>
                        </dd>
                    </dl>
                </div>
                <div class="ncap-form-all" select_recommend_id="<?php echo 1;?>">
                    <dl class="row">
                        <dt class="tit"><?php echo '商品';?></dt>
                        <dd class="opt">
                            <ul class="dialog-goodslist-s1 goods-list">
                                <?php if(!empty($output['code_recommend_list']['code_info'][1]['goods_list']) && is_array($output['code_recommend_list']['code_info'][1]['goods_list'])) { ?>
                                    <?php foreach($output['code_recommend_list']['code_info'][1]['goods_list'] as $k => $v) { ?>
                                        <li id="select_recommend_<?php echo 1;?>_goods_<?php echo $k;?>">
                                            <div ondblclick="del_recommend_goods(<?php echo $v['goods_id'];?>);" class="goods-pic">
                                                <span class="ac-ico" onclick="del_recommend_goods(<?php echo $v['goods_id'];?>);"></span>
                                                <span class="thumb size-72x72"><i></i><img select_goods_id="<?php echo $v['goods_id'];?>" title="<?php echo $v['goods_name'];?>" goods_name="<?php echo $v['goods_name'];?>" src="<?php echo strpos($v['goods_pic'],'http')===0 ? $v['goods_pic']:UPLOAD_SITE_URL."/".$v['goods_pic'];?>" onload="javascript:DrawImage(this,72,72);" /></span>
                                            </div>
                                            <div class="goods-name"><a href="<?php echo SHOP_SITE_URL."/index.php?act=goods&goods_id=".$v['goods_id'];?>" target="_blank"><?php echo $v['goods_name'];?></a></div>
                                            <input name="recommend_list[<?php echo 1;?>][goods_list][<?php echo $v['goods_id'];?>][goods_id]" value="<?php echo $v['goods_id'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo 1;?>][goods_list][<?php echo $v['goods_id'];?>][market_price]" value="<?php echo $v['market_price'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo 1;?>][goods_list][<?php echo $v['goods_id'];?>][goods_name]" value="<?php echo $v['goods_name'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo 1;?>][goods_list][<?php echo $v['goods_id'];?>][goods_price]" value="<?php echo $v['goods_price'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo 1;?>][goods_list][<?php echo $v['goods_id'];?>][goods_pic]" value="<?php echo $v['goods_pic'];?>" type="hidden">
                                        </li>
                                    <?php } ?>
                                <?php } ?>
                            </ul>
                        </dd>
                    </dl>
                </div>
        <div id="add_recommend_list" style="display:none;"></div>
        <div class="ncap-form-all">
            <dl class="row">
                <dt class="tit"><?php echo '选择要展示的商品';?></dt>
                <dd class="opt">
                    <div class="search-bar">
                        <label id="recommend_gcategory">商品分类
                            <input type="hidden" id="cate_id" name="cate_id" value="0" class="mls_id" />
                            <input type="hidden" id="cate_name" name="cate_name" value="" class="mls_names" />
                            <select>
                                <option value="0"><?php echo $lang['nc_please_choose'];?></option>
                                <?php if(!empty($output['goods_class']) && is_array($output['goods_class'])) { ?>
                                    <?php foreach($output['goods_class'] as $k => $v) { ?>
                                        <option value="<?php echo $v['gc_id'];?>"><?php echo $v['gc_name'];?></option>
                                    <?php } ?>
                                <?php } ?>
                            </select>
                        </label>
                        <input type="text" value="" name="recommend_goods_name" id="recommend_goods_name" placeholder="输入商品名称或SKU编号" class="txt w150">
                        <a href="JavaScript:void(0);" onclick="get_recommend_goods();" class="ncap-btn"><?php echo $lang['nc_query'];?></a></div>
                    <div id="show_recommend_goods_list" class="show-recommend-goods-list"></div>
                </dd>
            </dl>
        </div>
        <div class="bot"><a href="JavaScript:void(0);" onclick="update_recommend();" class="ncap-btn-big ncap-btn-green"><span><?php echo $lang['web_config_save'];?></span></a></div>
    </form>
</div>

<!-- 活动图片2 -->
<div id="upload_act_right_dialog" class="upload_act_dialog" style="display:none;">
    <div class="s-tips"><i class="fa fa-lightbulb-o"></i><?php echo $lang['web_config_prompt_act'];?></div>
    <form id="upload_act_right_form" name="upload_act_form" enctype="multipart/form-data" method="post" action="index.php?act=web_config&op=upload_pic" target="upload_pic">
        <input type="hidden" name="form_submit" value="ok" />
        <input type="hidden" name="web_id" value="<?php echo $output['code_act_right']['web_id'];?>">
        <input type="hidden" name="code_id" value="<?php echo $output['code_act_right']['code_id'];?>">
        <input type="hidden" name="act[pic]" value="<?php echo $output['code_act_right']['code_info']['pic'];?>">
        <input type="hidden" name="act[type]" value="pic">
        <div class="ncap-form-default" id="upload_act_right_type_pic" <?php if($output['code_act_right']['code_info']['type'] == 'adv') { ?>style="display:none;"<?php } ?>>
            <!--<dl class="row">
                <dt class="tit"><?php /*echo '活动名称';*/?></dt>
                <dd class="opt">
                    <input class="input-txt" type="text" name="act[title]" value="<?php /*echo $output['code_act']['code_info']['title'];*/?>">
                    <p class="notic"><?php /*echo '';*/?></p>
                </dd>
            </dl>-->
            <dl class="row">
                <dt class="tit">
                    <label><?php echo $lang['web_config_upload_url'].$lang['nc_colon'];?></label>
                </dt>
                <dd class="opt">
                    <input name="act[url]" value="<?php echo !empty($output['code_act_right']['code_info']['url']) ? $output['code_act_right']['code_info']['url']:SHOP_SITE_URL;?>" class="input-txt" type="text">
                    <p class="notic"><?php echo $lang['web_config_upload_act_url'];?></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label><?php echo $lang['web_config_upload_act'];?></label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show"><span class="type-file-box">
            <input type='text' name='textfield' id='textfield2' class='type-file-text' />
            <input type='button' name='button' id='button2' value='选择上传...' class='type-file-button' />
            <input name="pic" id="pic2" type="file" class="type-file-file" size="30">
            </span></div>
                    <p class="notic"><?php echo $lang['web_config_upload_act_tips'];?></p>
                </dd>
            </dl>
            <div class="bot"><a href="JavaScript:void(0);" onclick="$('#upload_act_right_form').submit();" class="ncap-btn-big ncap-btn-green"><?php echo $lang['nc_submit'];?></a></div>
        </div>
    </form>
</div>

<iframe style="display:none;" src="" name="upload_pic"></iframe>
<script src="<?php echo ADMIN_RESOURCE_URL;?>/js/jquery.ajaxContent.pack.js"></script>
<script src="<?php echo RESOURCE_SITE_URL;?>/js/common_select.js"></script>
<script src="<?php echo RESOURCE_SITE_URL;?>/js/waypoints.js"></script>
<script src="<?php echo ADMIN_RESOURCE_URL?>/js/web_index.js"></script>
